package com.ssy.lingxi.report.controller;

import com.ssy.lingxi.common.controller.BaseController;
import com.ssy.lingxi.common.response.Wrapper;
import com.ssy.lingxi.report.api.vo.response.ActiveMerchantVO;
import com.ssy.lingxi.report.model.vo.request.MemberMallBacklogRequest;
import com.ssy.lingxi.report.model.vo.response.MemberMallBacklogVO;
import com.ssy.lingxi.report.model.vo.response.PopularShopVO;
import com.ssy.lingxi.report.service.IActiveMerchantService;
import com.ssy.lingxi.report.service.IMemberHomeService;
import com.ssy.lingxi.report.service.IPopularShopService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.util.List;

/**
 * @menu 报表服务-商城能力
 * @author 伍将
 * @date 2020/11/2
 * @version 2.0.0
 */
@RestController
@RequestMapping("/report/mall")
public class MallController extends BaseController {

    @Resource
    private IPopularShopService popularShopService;

    @Resource
    private IActiveMerchantService activeMerchantService;

    @Resource
    private IMemberHomeService memberHomeService;

    /**
     * 企业商城首页-人气店铺
     * @author 伍将
     * @date 2020/11/3
     **/
    @RequestMapping(value = "/getPopularShopList", method = RequestMethod.GET)
    public Wrapper<List<PopularShopVO>> getPopularShopList(Integer count) {
        return popularShopService.getPopularShopList(count);
    }

    /**
     * 店铺-活跃商户（查询采购商户购买数量前top名）
     * @author 伍将
     * @date 2020/11/3
     **/
    @RequestMapping(value = "/getActiveMerchantList", method = RequestMethod.GET)
    public Wrapper<List<ActiveMerchantVO>> getActiveMerchantList() {
        return activeMerchantService.getActiveMerchantList();
    }

    /**
     * 商城-会员待办
     * @author 伍将
     * @date 2021/1/18
     **/
    @RequestMapping(value = "/getMemberMallBacklog", method = RequestMethod.GET)
    public Wrapper<MemberMallBacklogVO> getMemberMallBacklog(HttpServletRequest httpRequest, @Valid MemberMallBacklogRequest request) {
        return memberHomeService.getMemberMallBacklog(getSysUser(httpRequest), request.getIsPurchase());
    }
}
